package shopping;

import java.io.Serializable;

public class Item implements Serializable {
    private String name;    // 商品名称
    private String category; // 商品种类
    private double price;    // 商品价格
    private int quantity;    // 商品库存

    public Item(String name, String category, double price, int quantity) {
        this.name = name;
        this.category = category;
        this.price = price;
        this.quantity = quantity;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    @Override
    public String toString() {
        return "商品名称: " + name + ", 种类: " + category + ", 价格: " + price + "元, 库存: " + quantity;
    }
}
